﻿using System;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;

namespace PublishNews.Models
{
    public class ChangePasswordBindingModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Current password")]
        public string OldPassword { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public class RegisterBindingModel
    {
        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        [JsonProperty("password")]
        public string Password { get; set; }

        [JsonProperty("fullName")]
        public string FullName { get; set; }

        [EmailAddress]
        [JsonProperty("email")]
        public string Email { get; set; }

        [PhoneAttribute]
        [JsonProperty("phoneNumber")]
        public string PhoneNumber { get; set; }

        [JsonProperty("hideEmail")]
        public bool HideEmail { get; set; }

        [JsonProperty("rejectNews")]
        public bool RejectNews { get; set; }
    }

    public class RemoveLoginBindingModel
    {
        [Required]
        [Display(Name = "Login provider")]
        public string LoginProvider { get; set; }

        [Required]
        [Display(Name = "Provider key")]
        public string ProviderKey { get; set; }
    }

    public class SetPasswordBindingModel
    {
        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "New password")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm new password")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }
    }

    public class UserModel
    {
        [Required]
        [Display(Name = "Full name")]
        [JsonProperty("fullName")]
        public string FullName { get; set; }

        [Phone]
        [Display(Name = "Phone number")]
        [JsonProperty("phoneNumber")]
        public string PhoneNumber { get; set; }

        [Display(Name = "Fax")]
        [JsonProperty("fax")]
        public string Fax { get; set; }

        [Display(Name = "Is administrator")]
        public bool IsAdministrator { get; set; }

        [Required]
        [EmailAddress]
        [Display(Name = "Username")]
        [JsonProperty("fax")]
        public string UserName { get; set; }

        [Required]
        [Display(Name = "Password")]
        public string Password { get; set; }

        public string Id { get; set; }

        [Display(Name = "Hide email")]
        public bool HideEmail { get; set; }

        [Display(Name = "Reject news")]
        public bool RejectNews { get; set; }

        public bool Succeeded { get; set; }
    }

    public class EditUserModel
    {
        [Required]
        [Display(Name = "Full name")]
        [JsonProperty("fullName")]
        public string FullName { get; set; }

        [Phone]
        [Display(Name = "Phone number")]
        [JsonProperty("phoneNumber")]
        public string PhoneNumber { get; set; }

        [Display(Name = "Fax")]
        [JsonProperty("fax")]
        public string Fax { get; set; }

        [Display(Name = "Is administrator")]
        public bool IsAdministrator { get; set; }

        [Required]
        [EmailAddress]
        [Display(Name = "Username")]
        [JsonProperty("userName")]
        public string UserName { get; set; }

        [JsonProperty("id")]
        public string Id { get; set; }

        [Display(Name = "Hide email")]
        [JsonProperty("hideEmail")]
        public bool HideEmail { get; set; }

        [Display(Name = "Reject news")]
        [JsonProperty("rejectNews")]
        public bool RejectNews { get; set; }

        public bool Succeeded { get; set; }
    }


    public class ViewUserModel
    {
        [JsonProperty("fullName")]
        public string FullName { get; set; }

        [JsonProperty("phoneNumber")]
        public string PhoneNumber { get; set; }

        [JsonProperty("fax")]
        public string Fax { get; set; }

        [JsonProperty("userName")]
        public string UserName { get; set; }

        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("hideEmail")]
        public bool HideEmail { get; set; }

        [JsonProperty("rejectNews")]
        public bool RejectNews { get; set; }

        [JsonProperty("gold")]
        public int Gold { get; set; }

        [JsonProperty("numberOfNews")]
        public int NumberOfNews { get; set; }
    }

    public class ChangePasswordModel
    {
        [JsonProperty("userId")]
        public string UserId { get; set; }
        [Display(Name = "Current password")]
        [JsonProperty("currentPassword")]
        public string CurrentPassword { get; set; }
        [Display(Name = "New password")]
        [JsonProperty("newPassword")]
        public string NewPassword { get; set; }
        public bool Succeeded { get; set; }
    }
}
